package RenRen;

import java.io.IOException;

import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpVersion;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.CoreProtocolPNames;
import org.apache.http.protocol.HttpContext;

public class CoreProtocal {
public static void main(String[] args) {
	DefaultHttpClient httpclient = new DefaultHttpClient();
	System.out.println(CoreProtocolPNames.PROTOCOL_VERSION);
	httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, 
	    HttpVersion.HTTP_1_0);
	httpclient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, 
	    "UTF-8");
	HttpGet httpget = new HttpGet("http://www.google.com/");
	httpget.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, 
	    HttpVersion.HTTP_1_1);
	httpget.getParams().setParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, 
	    Boolean.FALSE);
	httpclient.addRequestInterceptor(new HttpRequestInterceptor() {
	    public void process(
	            final HttpRequest request, 
	            final HttpContext context) throws HttpException, IOException {
	        System.out.println(request.getParams().getParameter(
	                CoreProtocolPNames.PROTOCOL_VERSION));
	        System.out.println(request.getParams().getParameter(
	                CoreProtocolPNames.HTTP_CONTENT_CHARSET));
	        System.out.println(request.getParams().getParameter(
	                CoreProtocolPNames.USE_EXPECT_CONTINUE));
	        System.out.println(request.getParams().getParameter(
	                CoreProtocolPNames.STRICT_TRANSFER_ENCODING));
	    }

	    
	    
	});
}
}
